<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../three.min.js"></script>
</head>
<body>
    <script>
        const width = window.innerWidth;
        const height = window.innerHeight;
        var renderer = new THREE.WebGLRenderer()
        renderer.setSize(width,height)
        renderer.setClearColor("black",1)
        document.body.appendChild(renderer.domElement)
        var scene = new THREE.Scene()
        var camera = new THREE.PerspectiveCamera(45,width/height,0.1,1000)
        camera.position.set(0,0,500)
        camera.up.set(0,1,0)
        camera.lookAt(new THREE.Vector3(0,0,0))
        //light
        var light = new THREE.DirectionalLight(0xffffff)
        light.position.set( 200, 200, 1000 ).normalize();
        scene.add( light );
        //obj
        var geometry = new THREE.BoxGeometry(100,100,100)
        //MeshLambertMaterial  MeshBasicMaterial
        var material = new THREE.MeshLambertMaterial({color:'red',
        side:THREE.BackSide})
        console.log(material)
        var mesh = new THREE.Mesh(geometry,material)
        scene.add(mesh)
        //渲染
        function render() {
            requestAnimationFrame(render)
            mesh.rotation.y+=0.01
            renderer.render(scene,camera)
        }
        render()
        
    </script>
</body>
</html>